﻿using System;

using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Collections;

namespace Silvermoon.Controls
{
    internal class ItemContainerCollection : BindingList<Item>, IDisposable, IList
    {
        private ListView listView;

        public ItemContainerCollection(ListView listView)
            : base()
        {
            this.listView = listView;
        }

        public virtual void Dispose()
        {
            RaiseListChangedEvents = false;
            foreach (Item item in this)
            {
                item.Dispose();
            }
            this.Clear();
        }

        protected override void InsertItem(int index, Item item)
        {
            base.InsertItem(index, item);
            //item.Host = listView;
        }

        protected override void RemoveItem(int index)
        {
            //this[index].Host = null;
            base.RemoveItem(index);
        }
    }
}
